package com.atguigu.java1;

/**
 *
 *     关于变量的赋值
 *         如果变量是基本数据类型，此时赋值的是变量所保存的数据值
 *         如果变量是引用数据类型，此时赋值的是变量所保存的数据的地址值
 *
 * @author : leimingchao
 * @date Date : 2021年08月16日 22:14
 */
public class ValueTransferTest {
    public static void main(String[] args) {
        System.out.println("************基本数据类型：**************");
        int m = 10, n = m;
        System.out.println("m = " + m + ",n = " + n);
        n = 20;
        System.out.println("m = " + m + ",n = " + n);
        System.out.println("****************引用数据类型：**********");
        Order order = new Order();
        order.orderId = 1001;
        //赋值以后，order和order2的地址值相同，都指向了堆空间中同一个对象实体
        Order order2 = order;
        System.out.println("order.orderId = " + order.orderId + ",order2.orderId = " + order2.orderId);
        order2.orderId = 1002;
        System.out.println("order.orderId = " + order.orderId + ",order2.orderId = " + order2.orderId);
    }
}


class Order {
    int orderId;
}
